#include <iostream>
#include <functional>
#include <vector>

std::vector<std::function<bool(int)>> Funcs;

void addFuncs(int) {
    int divisor = 10;

    {
        //undefined behavior
        // Funcs.push_back([&](int){
        //     return divisor / 10 == 0;
        // });

        Funcs.push_back([&divisor](int){
            return divisor / 10 == 0;
        });
    }

    {
        auto lam = [&divisor]() {
            return divisor / 10 == 0;
        };

        lam();
    }

    {
        Funcs.push_back([=](int){
            return divisor / 10 == 0;
        });
    }
}

class Wdiget {
private:
    int divisor;

public:
    void AddFunc() {
        {
            Funcs.push_back([=](int){
                return divisor / 10 == 0;
            });

            // Funcs.push_back([divisor](int){
            //     return divisor / 10 == 0;
            // });
        }

        {
            auto divisorCpy = divisor;

            Funcs.push_back([divisorCpy](int){
                return divisorCpy / 10 == 0;
            });

            //c++ 14
            Funcs.push_back([divisor = divisor](int){
                return divisor / 10 == 0;
            });
        }
    }
};

void addFunc1() {
    static int divisor = 0;

    Funcs.push_back([=](int){
        return divisor / 10 == 0;
    });

    divisor++;
}

int main() {
    return 0;
}